<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html>
<script>
     const login = (username,password)=>{
         return new Promise((resolve,reject)=>{
             if (username.length<6 || password.length<6) {
                 reject("用户名或密码至少为6位")
             }
             if (username=="user123" && password=="123456") {
                 resolve("登录成功！");
             } else {
                 reject("用户名或密码错误");
             }
         })
     }
     const username="123";
     const password="123456";
     login(username,password).then((resolve)=>{
         console.log(resolve);
     }).catch((reject)=>{
         console.log(reject)
     })
</script>